package service

import (
	"ip_server/jwt"
	. "ip_server/service/controller"

	"github.com/gin-gonic/gin"
)

func Init(r *gin.Engine) {
	taR := r.Group("/api")
	taR.POST("/login", (&UserController{}).Login)
	taR.Use()
	{

		taR.POST("/auth/signout", (&UserController{}).Signout)

		tyPytaR := taR.Group("/rcs")
		tyPytaR.POST("/sync-saas", (&IndexController{}).ChannelAntiCheat)
		tyPytaR.POST("/new-sync-saas", (&IndexController{}).NewChannelAntiCheat)
		tyPytaR.POST("/factor-saas", (&IndexController{}).DeviceRiskCheck)
	}

	taR.Use(jwt.JWTAuth())
	{
		// 分组模块
		logtaR := taR.Group("/log")
		logtaR.GET("", (&IndexController{}).LogList)
		// 分组模块
		conftaR := taR.Group("/config")
		conftaR.GET("", (&IndexController{}).ConfigList)
		// 分组模块
		grptaR := taR.Group("/black")
		grptaR.GET("", (&BlackController{}).List)
		grptaR.POST("", (&BlackController{}).Add)
		grptaR.PATCH("", (&BlackController{}).Update)
		grptaR.DELETE("", (&BlackController{}).Delete)
	}
}
